package com.ruoyi.langchain4j.assistant;

import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.spring.AiService;
import reactor.core.publisher.Flux;

import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT;

/**
 * @className: XiaoZhiAgent
 * @date: 2025-7-11 10:06
 * @description:
 */

/**
 * 正常回答chatModel = "ollamaChatModel",
 * 流式回答chatModel = "ollamaChatModel",
 */
@AiService(
        wiringMode = EXPLICIT,
        chatModel = "ollamaChatModel",
        streamingChatModel = "ollamaStreamingChatModel",
        chatMemoryProvider = "chatMemoryProviderXiaoZhi",
        tools = "appointmentTools",
        contentRetriever = "contentRetrieverXiaoZhiElasticsearch"
)
public interface XiaoZhiAgent {

    /**
     *  正常回答
     * @param memoryId
     * @param userMessage
     * @return
     */
    @SystemMessage(fromResource = "xiaozhi-prompt-template.txt")
    String chat(@MemoryId String memoryId, @UserMessage String userMessage);

    /**
     * 流式回答
     * @param memoryId
     * @param userMessage
     * @return
     */
    @SystemMessage(fromResource = "xiaozhi-prompt-template.txt")
    Flux<String> streamChat(@MemoryId String memoryId, @UserMessage String userMessage);

}
